<template>
  <div class="child">
    <h1>我是Child组件(子)</h1>
    <h1>汽车: {{ name }}--{{ price }}</h1>
    <Son />
  </div>
</template>
  
  <script>
import Son from "./Son";
import { toRefs, inject } from "vue";
export default {
  name: "child",
  components: {
    Son
  },
  setup() {
    let car = inject("car");
    return { ...toRefs(car) };
  }
};
</script>
  
  <style>
.child {
  background-color: skyblue;
  padding: 10px;
}
</style>